<template>
  <div class="recommand-warp">
    <div class="recommand-title">
      <span class="title-icon iconfont">&#xe60c;</span>
      <span class="title-info">猜你喜欢</span>
    </div>
    <ul class="recommand-list">
      <li class="recommand-item" v-for="item in recommendList" :key="item.id">
        <router-link to="/detail" class="recommand-item-link">
          <div class="link-warp">
            <div class="link-img-warp">
              <img :src="item.imgUrl" />
              <span class="link-state" v-if="item.tag == '可定明日'" v-bind:style="tomBack">可定明日</span>
              <span class="link-state" v-if="item.tag == '随买随用'" v-bind:style="curBack">随买随用</span>
            </div>
          </div>
          <div class="link-info">
            <div class="info-name">{{item.title}}</div>
            <div class="info-like-comment">
              <div class="comment-starlevel" v-for="starItem in item.starLevel">
                <span class="iconfont">&#xe658;</span>
              </div>
              <span class="comment-num">{{item.commentNum}}条评论</span>
            </div>
            <div class="info-price">
              <span class="price-info">￥{{item.price}}</span>
              <span class="price-unit">起</span>
              <span class="info-address">{{item.district}}</span>
            </div>
            <div class="info-feature" v-if="item.feature">
              <span class="info-feature-text">{{item.feature}}</span>
            </div>
          </div>
        </router-link>

      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    name: 'Recommand',
    props:{
      recommendList:Array
    },
    data: function() {
      return {
        curBack: {
          backgroundImage: 'url(https://img1.qunarzz.com/piao/fusion/1802/20/2ba6d10b17972e02.png)'
        },
        tomBack: {
          backgroundImage: 'url(https://img1.qunarzz.com/piao/fusion/1802/52/b9080e45b69b4f02.png)'
        }
      }
    }
  }
</script>

<style scoped="scoped">
  img {
    width: 100%;
    height: 100%;
  }

  .recommand-warp {
    width: 100%;
    margin-top: .2rem;
  }

  .recommand-title {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: .94rem;
    line-height: .94.rem;
    padding: 0 5px;
  }

  .recommand-title span {
    line-height: .94rem;

  }

  .recommand-title span:nth-child(1) {
    color: #FF0000;
  }

  .recommand-title span:nth-child(2) {
    font-size: .32rem;
    margin-left: 5px;
  }

  .recommand-list {
    list-style: none;
    width: 100%;
    padding: 0 5px;
  }

  .recommand-list .recommand-item .recommand-item-link {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 98%;
    text-decoration: none;
    border-bottom: 1px solid #EAEAEA;
  }

  .recommand-list .recommand-item .recommand-item-link .link-warp {
    position: relative;
    display: flex;
    align-items: center;
    width: 2rem;
    height: 2rem;

  }


  .recommand-list .recommand-item .recommand-item-link .link-warp .link-state {
    position: absolute;
    left: 0;
    top: .21rem;
    width: 1.02rem;
    height: .38rem;
    background-size: 100%;
    color: #fff;
    font-size: .2rem;
    line-height: .38rem;
    text-indent: .04rem;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info {
    width: 100%;
    padding-left: .22rem;
    text-align: left;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-name {
    margin-top: .26rem;
    height: .44rem;
    color: #212121;
    font-size: .32rem;
    line-height: .44rem;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-like-comment {
    margin-top: .14rem;
    height: .34rem;
    color: #616161;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-like-comment .comment-starlevel {
    display: inline-block;
    color: orange;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-like-comment .comment-num {
    margin-left: 5px;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-price {
    position: relative;
    margin-top: .22rem;
    color: #616161;
    font-size: .24rem;
    line-height: .4rem;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-price .price-info {
    color: orange;
    font-size: .4rem;
  }

  .recommand-list .recommand-item .recommand-item-link .link-info .info-price .info-address {
    float: right;
    margin-right: 10px;
  }


  .recommand-list .recommand-item .recommand-item-link .link-info .info-feature {
    display: inline-block;
    margin-top: .48rem;
    margin-right: .24rem;
    background: #fff9f9;
    padding: .04rem .1rem;
    color: #f55;
    font-size: .24rem;
    line-height: .34rem;
  }
</style>
